package com.chixing.day04.homework;

/**
 * @author Y2014188432
 */
public class One {
    public static void main(String[] args) {
        int[] score = {78,56,67,94,73,80,62,90,88,63};
        for (int i = 0; i < score.length; i++) {
            if(isPole(score,i)){
                System.out.print(i + "  ");
            }
        }
    }

    /**
     * 判断是否是极点
     * @param s 数组
     * @param index 下标
     * @return true / false
     */
    public static boolean isPole(int[] s,int index){
        // 如果是两端，则必定是极点
        if(index == 0 || index == s.length - 1){
            return true;
        }
        return s[index] > s[index - 1] && s[index] > s[index + 1] || s[index] < s[index - 1] && s[index] < s[index + 1];
    }
}
